package b1.controls.basic
{
	import flash.display.Sprite;
	import flash.text.*;

	public class BasicMessage extends Sprite
	{
		public function BasicMessage(width:int, height:int, text:String, roundRecColor:uint = 0x50AF50, txtColor:uint = 0x000000, wordWrap:Boolean = false)
		{
			super();
			//加载背景
			var roundRec:RoundRec = new RoundRec(width, height, 0.8, roundRecColor);
			addChild(roundRec);
			//加载文字
			var titleText:TextField = new TextField();
			titleText.selectable = false;
        	titleText.autoSize = TextFieldAutoSize.LEFT;
			titleText.defaultTextFormat = new TextFormat("微软雅黑", 15, txtColor);
			titleText.text = text;
			if (wordWrap)
			{
				titleText.width = width;
				titleText.wordWrap = wordWrap;
				titleText.x = (this.width - titleText.width) / 2 + 5;
			}
			else
			{
				titleText.x = (this.width - titleText.width) / 2;
			}
			titleText.y = (this.height - titleText.height) / 4;
			addChild(titleText);
		}
	}
}